﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VideoNetApplication.Common;
using VideoNetApplication.Common.CacheManager;
using VideoNetApplication.Common.Extension;
using VideoNetApplication.Common.Helper;
using VideoNetApplication.Common.Service;

namespace VideoNetApplication.Control
{
    public partial class Header : BaseControl
    {

        
        public string Urlhtml;
        public V_school vSchool;
        protected void Page_Load(object sender, EventArgs e)
        {
            hfSchoolID.Value = SchoolId.ToString();
            GetLogo();
            GetHeadLink();
        }
        private  void  GetLogo()
        {
            var sm = new SchoolConfigService();
             vSchool = sm.QuerySchoolById(SchoolId);
            CommonCacheManager.AddCacheData<V_school>("School"+SchoolId,vSchool,600);
            //string dictionarySavedPath =
            //    StringUtils.GetWebConfigValue("VideoPath").Replace("SchoolId", SchoolId.ToString()) +
            //    vSchool.VS_logofile;
            //ltrLogo.Text = "<img   src=\"" + ResolveUrl(dictionarySavedPath) + "\" id=\"logo\">";
            if (vSchool!=null)
            {
                ltrLogo.Text = "<img   src=\"" + PictureServerName+ vSchool.VS_logofile + "\" id=\"logo\">";

                
            }
        }

        private  void  GetHeadLink()
        {
            A1.HRef = "~/Default.aspx?SchoolId=" + SchoolId;
            A2.HRef = "~/UserCenter/UserCourseCalendar.aspx?schoolId=" + SchoolId;
            A3.HRef = "~/ViewTeacherListHtml.aspx?SchoolId=" + SchoolId;
            A4.HRef = "~/ViewNewsListHtml.aspx?schoolId=" + SchoolId;
            A5.HRef = "~/ViewRecruitListHtml.aspx?schoolId=" + SchoolId;
            //A6.HRef = "~/ResourseDownload.aspx?SchoolId=" + SchoolId;
            A7.HRef = "~/ViewAllCoursesHtml.aspx?SchoolId=" + SchoolId;
            //Urlhtml += "<li><a href=\'" + ResolveUrl("ev" + SchoolId + "/index.ev") + "\'>首页</a></li>";
            //Urlhtml += "<li><a href=\'" + ResolveUrl("UserCenter/UserCourseCalendar.aspx?schoolId=" + SchoolId) +
            //           "\'>复习频道</a></li>";
            //Urlhtml += "<li><a href=\'" + ResolveUrl("ViewTeacherHtml.aspx?schoolId=" + SchoolId) +
            //           "\'>名师风采</a></li>";
            //Urlhtml += "<li><a href=\'" +
            //           ResolveUrl("ViewSNewsListHtml.aspx?schoolId=" + SchoolId) +
            //           "\'>学校新闻</a></li>";
            //Urlhtml += "<li><a href=\'" + ResolveUrl("ViewRecruitListHtml.aspx?schoolId=" + SchoolId) +
            //           "\'>招生简章</a></li>";
            //Urlhtml += "<li><a href='UserCenter/ResourseDownload.aspx?SchoolId=" + SchoolId +
            //           "'>资源下载</a></li>";
            //ltrHeadLink.Text = Urlhtml;

        }
    }
}